
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<link rel=stylesheet href='include/hoj.css' type='text/css'>
</head>
<body>
<center>
<div style="width:90%; text-align:left">
<img src="image/logo.png"/>
</div>
<table width=96%> 
	<tr align="center" class='hd' valign="top">
				<th><a href="faqs.php">F.A.Qs</a></th>
		<th><a href="./bbs.php">Web Board</a></th>
		<th><a href="./">Home</a></th>
		<th><a href="./problemset.html">ProblemSet</a></th>
		<th><a href="./status.php">Status</a></th>
		<th><a href="./ranklist.php">Ranklist</a></th>
		<th><a href="./contest.php">Contest</a></th>
		<th><a href=loginpage.php>Login</a></th><th><a href=registerpage.php>Register</a></th>	</tr>
</table>
</center>
<center>
<div class="notice">
	<div>
		<B>Notice:</B>鉴于种种原因，本OJ自下周星期一（3月5号）开始不再全面开放，请各位做好善后事宜，谢谢合作。	</div>
</div>
</center>
</div>
<title>Problem 1983. -- 毛毛虫的伪装 -- 衡阳八中OJ离线版-2012-02-29</title><center><h2>1983: 毛毛虫的伪装</h2><span class=green>Time Limit: </span>5 Sec&nbsp;&nbsp;<span class=green>Memory Limit: </span>64 MB<br><span class=green>Submit: </span>34&nbsp;&nbsp;<span class=green>Solved: </span>5<br>[<a href='submitpage.php?id=1983'>Submit</a>][<a href='problemstatus.php?id=1983'>Status</a>][<a href='bbs.php?id=1983'>Discuss</a>]</center><h2>Description</h2><div class=content><p>菜妈在你的帮助下解决了菜儿们的问题后，就到一边睡觉去了（咦？不是说菜妈是个勤劳的菜农麽？&hellip;&hellip;）。此时，一只可爱的毛毛虫来到了菜园里，正在啃食菜妈的菜儿们&hellip;&hellip; 可是菜妈警觉性极高，一听到毛毛虫啃食菜儿们的声音，菜妈就醒了。然后以光速拿来了毛毛虫最害怕的武器&mdash;&mdash;DDT。就在菜妈冲向毛毛虫的时候，毛毛虫忽然想起菜妈是信仰一个***教的，而该***教是崇尚对称之美的，于是毛毛虫决定变换成&ldquo;对称毛毛虫&rdquo;，这样菜妈就不会拿DDT来喷毛毛虫了。这只奇怪的毛毛虫的身上有2N个字母，这些字母排成一行。每次操作，毛毛虫只能把其中某个字母移动到另一个字母的前面或者后面。由于时间紧迫，毛毛虫必须用最少的操作步数使得自己变成&ldquo;对称毛毛虫&rdquo;。</p></div><h2>Input</h2><div class=content><p>第一行一个正整数N。第二行为毛毛虫身上的2N个字母。</p></div><h2>Output</h2><div class=content><p>输出毛毛虫需要的最少操作步数。</p></div><h2>Sample Input</h2>
			<div class=content><span class=sampledata>4<br />
aaabbbab<br />
</span></div><h2>Sample Output</h2>
			<div class=content><span class=sampledata>2<br />
<br />
【Data Range】<br />
N<=500,000，所有字母均为小写字母。<br />
数据保证有解。<br />
</span></div><h2>HINT</h2>
			<div class=content><p></p></div><h2>Source</h2>
			<div class=content><p><a href='problemset.html?search=绍兴一中'>绍兴一中</a></p></div><center>[<a href='submitpage.php?id=1983'>Submit</a>][<a href='problemstatus.php?id=1983'>Status</a>][<a href='bbs.php?id=1983'>Discuss</a>]</center>﻿<br>

<a href="./"><span class=red>HOME</span></a>
<a href="javascript:history.go(-1)"><span class=red>Back</span></a>

<hr>
<center>
	<div class="footer">
			<a href=setlang.php?lang=ko>한국어</a>&nbsp;
		<a href=setlang.php?lang=cn>中文</a>&nbsp;
		<a href=setlang.php?lang=fa>فارسی</a>&nbsp;
		<a href=setlang.php?lang=en>English</a>&nbsp;
		<a href=setlang.php?lang=th>ไทย</a>
	<br>		<div>版权所有 &copy;2008-2012 WaterPark Organization. | <script src="http://s21.cnzz.com/stat.php?id=2982771&web_id=2982771" language="JavaScript"></script>
</div>
		<div>Based on opensource project <a href="http://hustoj.googlecode.com">hustoj</a>.</div>
	</div>
</center>
</body>
</html>
